package com.manage.common;


/**
 * 响应码枚举，参考HTTP状态码的语义
 */

public enum ResponseEnum {
    SUCCESS(200, "成功"),
    FAIL(400, "失败"),
    NOT_FOUND(404, "请求的资源（网页等）不存在"),
    UNKNOWN_ERROR(500, "未知异常"),
    AUTH_ERROR(502, "授权失败!"),
    SERVER_BUSY(503, "服务器正忙，请稍后再试!"),
    DATABASE_OPERATION_FAILED(504, "数据库操作失败"),
    PARAM_ERROR(1002, "参数校验失败"),
    TOKEN_ERROR(302, "token无效");

    private int code;
    private String message;

    ResponseEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }

    @Override
    public String toString() {
        return "ResponseEnum{" + "code='" + code + '\'' + ", msg='" + message + '\'' + "} " + super.toString();
    }
}

